<?php

namespace app\controller\api\data;

use app\services\data\webscript\AdStatScriptService;
use support\Request;

class AdStatController
{
    public function statDataGetReport(Request $request)
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGetReport($params);
        return yqok($data);
    }

    public function statDataGet(Request $request, $type = '')
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGet($params, $type);
        return yqok($data);
    }

    public function statDataGetXuni(Request $request)
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGetXuni($params);
        return yqok($data);
    }

    public function statDataGetMidas(Request $request)
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGetMidas($params);
        return yqok($data);
    }

    public function statDataGetKeep(Request $request)
    {
        $params              = $request->all();
        $params['keep_type'] = 1;
        $params['keep_days'] = [2,3,5];

        $data = AdStatScriptService::getInstance()->statDataGetKeep($params);
        return yqok($data);
    }

    public function statDataGetKeepPay(Request $request)
    {
        $params              = $request->all();
        $params['keep_type'] = 2;
        $params['keep_days'] = [2,3,5];

        $data = AdStatScriptService::getInstance()->statDataGetKeep($params);
        return yqok($data);
    }

    public function statDataGetKeepPayOne(Request $request)
    {
        $params               = $request->all();
        $params['keep_type']  = 5;
        $params['keep_style'] = 'loss';
        $params['keep_days']  = [2];

        $data = AdStatScriptService::getInstance()->statDataGetKeep($params);
        return yqok($data);
    }

    public function statDataGetKeepPayOld(Request $request)
    {
        $params               = $request->all();
        $params['keep_type']  = 6;
        $params['keep_style'] = 'loss';
        $params['keep_value'] = 'value';
        $params['keep_days']  = [2];

        $data = AdStatScriptService::getInstance()->statDataGetKeep($params);
        return yqok($data);
    }

    public function statDataGetKeepOld(Request $request)
    {
        $params               = $request->all();
        $params['keep_type']  = 7;
        $params['keep_style'] = 'loss';
        $params['keep_value'] = 'value';
        $params['keep_days']  = [2];

        $data = AdStatScriptService::getInstance()->statDataGetKeep($params);
        return yqok($data);
    }

    public function statDataGetRoi(Request $request)
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGetRoi($params);
        return yqok($data);
    }

    public function statDataGetRoiMidas(Request $request)
    {
        $params = $request->all();

        $data = AdStatScriptService::getInstance()->statDataGetRoiMidas($params);
        return yqok($data);
    }

    public function statDataGetLtv(Request $request)
    {
        $params        = $request->all();
        $params['ltv'] = 1;

        $data = AdStatScriptService::getInstance()->statDataGetLtv($params);
        return yqok($data);
    }
}
